home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 4693 / text0000.txt < prev   
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  37 lines

  1.  
  2. In a msg of 12 Feb 96 Timothy Eves wrote to All:
  3.  
  4.  TE> Whilst looking through the Autodocs (OS v40) for the utility.library
  5.  TE> I've come across several refernces to some software constructs called
  6.  TE> Namespaces. What are they and what can the be used for?
  7.  
  8. The namespace refers to the parts of a variable-name, used to make in
  9. unique within a program. The intention is to keep names as short as
  10. possible, without loosing the meaning. Things like routine-names etc. don't
  11. belong to variables and are a waist of 'namespace' (this waist is called
  12. 'namespace-polution'. For example
  13.  
  14.  Routine()
  15.  {
  16.    int Routine_var1, Routine_var2;
  17.    etc...
  18.  }
  19.  
  20. The parts 'Routine_' are a wast of name-space. It's obvious they don't
  21. belong here and can be removed. But when you're using a lot of global
  22. variables (NOT recommended!), you will need these constructions. Try to
  23. avoid them! C++ is a language which highly reduces namespace-polution.
  24.  
  25. In relation to the utility.library, I think the name-space relates to
  26. constant-names of tag-items. Usually the first two characters (followed by
  27. an underscore) are the 'namespace' to make the constant-names unique.
  28.  
  29. I'm not sure if I cleared things up or if I only made it more confusing :)
  30.  
  31. Greetings,
  32.  
  33.   _            _              _
  34.  /_)          /_)          __// Hobby programmer...  Fido: 2:280/464.2
  35. / atrick van /_)eem        \X/  e-mail: patrick.van.beem@aobh.xs4all.nl
  36.  
  37.